<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateMenusTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('menus', function (Blueprint $table) {
            $table->increments('id')->comment('菜单表');
            $table->integer('pid')->default(0)->comment('父级 ID');
            $table->tinyInteger('sort')->default(0)->comment('排序');
            $table->string('name', 30)->default('')->comment('名称');
            $table->string('icon', 30)->default('')->comment('图标');
            $table->string('route', 100)->default('')->comment('路由');
            $table->tinyInteger('is_show')->default(0)->comment('是否显示 0：否 1：是');
            $table->index('pid');
            $table->index('is_show');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('menus');
    }
}
